   package com.dcivision.user.web;

  import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;

import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.TextUtility;
import com.dcivision.framework.bean.AbstractBaseObject;
import com.dcivision.framework.web.AbstractActionForm;
import com.dcivision.user.bean.UserGroup;

  /**
    MaintUserImportDataForm.java

    This class is the for user import data form purpose.

    @author           Susan liu
    @company          DCIVision Limited
    @creation date    21/07/2004
    @version          $Revision: 1.4 $
  */

  public class MaintUserImportDataForm extends AbstractActionForm {

  public static final String REVISION = "$Revision: 1.4 $";



    /** Holds value of property userRoles. */
    private String[] userRoles = null;
    private FormFile uploadFile=null;

    public MaintUserImportDataForm() {
      super();
    }

    public  void  setUploadFile(FormFile uploadFile)
    {
      this.uploadFile=uploadFile;
    }


    public  FormFile  getUploadFile()
    {
      return this.uploadFile;
    }


    public String[] getUserRoles() {
      return(this.userRoles);
    }

    public void setUserRoles(String[] userRoles) {
      this.userRoles = userRoles;
    }

    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
      return super.validate(mapping, request);
    }

    public void reset(ActionMapping mapping, HttpServletRequest request) {
      super.reset(mapping, request);
      this.setID(null);
      this.setRecordStatus(null);
      this.setUpdateCount(null);
      this.setCreatorID(null);
      this.setCreateDate(null);
      this.setUpdaterID(null);
      this.setUpdateDate(null);
      this.setUserRoles(null);
    }

    public AbstractBaseObject getFormData() throws ApplicationException {
      UserGroup tmpUserGroup = new UserGroup();
      tmpUserGroup.setID(TextUtility.parseIntegerObj(this.getID()));
      tmpUserGroup.setRecordStatus(this.getRecordStatus());
      tmpUserGroup.setUpdateCount(TextUtility.parseIntegerObj(this.getUpdateCount()));
      tmpUserGroup.setCreatorID(TextUtility.parseIntegerObj(this.getCreatorID()));
      tmpUserGroup.setCreateDate(parseTimestamp(this.getCreateDate()));
      tmpUserGroup.setUpdaterID(TextUtility.parseIntegerObj(this.getUpdaterID()));
      tmpUserGroup.setUpdateDate(parseTimestamp(this.getUpdateDate()));
      return tmpUserGroup;
    }

    public void setFormData(AbstractBaseObject baseObj) throws ApplicationException {
      UserGroup tmpUserGroup = (UserGroup)baseObj;
      this.setID(TextUtility.formatIntegerObj(tmpUserGroup.getID()));
      this.setRecordStatus(tmpUserGroup.getRecordStatus());
      this.setUpdateCount(TextUtility.formatIntegerObj(tmpUserGroup.getUpdateCount()));
      this.setCreatorID(TextUtility.formatIntegerObj(tmpUserGroup.getCreatorID()));
      this.setCreateDate(formatTimestamp(tmpUserGroup.getCreateDate()));
      this.setUpdaterID(TextUtility.formatIntegerObj(tmpUserGroup.getUpdaterID()));
      this.setUpdateDate(formatTimestamp(tmpUserGroup.getUpdateDate()));
    }
  }
